import java.util.Stack;

/**
 * Created with IntelliJ IDEA.
 * Description: 除开长度为 1 的数，满足看成 16 进制后是自己的整数倍的最小数
 */
public class Test2 {
    public static void main(String[] args) {
        for (int i = 1; i < 100000; i++) {
            int num = func(i);
            if(num % i == 0) {
                System.out.print(i + " ");
            }
        }
    }

    public static int func(int num) {
        int ans = 0;
        int tmp = 1;
        while(num != 0) {
            ans += (num % 10) * tmp;
            tmp *= 16;
            num /= 10;
        }
        return ans;
    }
}
